home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / mslang / poetmf / src / hello.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-31  |  2.4 KB  |  114 lines

  1. //*****************************************************************
  2. //
  3. //    hello.cxx        Hello POET implemented model
  4. //
  5. //    Implementation of the following classes:
  6. //        Person
  7. //        Programmer
  8. //
  9. //    Remarks
  10. //        This modul contains the model of the database classes
  11. //        The model is independent from the user interface
  12. //
  13. //    Author:    BKS Software, April 91
  14. //
  15. //*****************************************************************
  16.  
  17. //    standard includes for the C++ & WINDOWS environment
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. #include <string.h>
  21.  
  22. // general include file for the POET environment
  23. #include <poet.hxx>
  24.  
  25. // the database model of the application
  26. #include <base.hxx>
  27. #include <hello.hxx>
  28.  
  29. char * Address::Print( char * buffer )
  30. {
  31.     sprintf( buffer, "%s, %d, %s", (char*)street, zip, (char*)city );
  32.     return buffer;
  33.  
  34. }
  35.  
  36. //-------------------------------------------------------------------
  37.  
  38. void Person::Init ()
  39. {
  40.     name = "";
  41.     firstnames.Clear ();
  42.     adrs.Clear ();
  43. }
  44.  
  45. //-------------------------------------------------------------------
  46.  
  47. Person::~Person()
  48. {
  49.     firstnames.Clear();
  50.     adrs.Clear();
  51. }
  52.  
  53. //-------------------------------------------------------------------
  54.  
  55. char * Person::Print ( char * buffer )
  56. {
  57.     int    erc;
  58.  
  59.     sprintf ( buffer, "%s", (char *) name);
  60. //    Firstnames
  61.     PtString    fname;
  62.     for ( erc = firstnames.Seek (0L, PtSTART);
  63.         erc == 0; erc = firstnames.Seek (1L, PtCURRENT) )
  64.     {
  65.         firstnames.Get (fname);
  66.         strcat ( buffer, ",  ");
  67.         strcat ( buffer, (char *) fname );
  68.     }
  69.  
  70. //    first address
  71.     if ( adrs.Seek (0L, PtSTART) == 0 )
  72.     {
  73.         Address        *adr;
  74.         char        buf2[100];
  75.  
  76.         adrs.Get ( adr );
  77.         strcat ( buffer, ",  ");
  78.         strcat ( buffer, adr->Print ( buf2 ));
  79.         adrs.Unget ( adr );
  80.     }
  81.     return buffer;
  82. }
  83.  
  84. //-------------------------------------------------------------------
  85.  
  86. Programmer::~Programmer()
  87. {
  88.     ;
  89. }
  90.  
  91. //-------------------------------------------------------------------
  92.  
  93. void Programmer::Init ()
  94. {
  95.     Person::Init ();
  96.     exp_years = 0;
  97.     language = "";
  98. }
  99.  
  100. //-------------------------------------------------------------------
  101.  
  102. char * Programmer::Print ( char * buffer )
  103. {
  104.     char    expstring[50];
  105.  
  106.     sprintf ( expstring, "%d", exp_years);
  107.     Person::Print ( buffer );
  108.     strcat ( buffer, ",  ");
  109.     strcat ( buffer, (char *) expstring);
  110.     strcat ( buffer, ",  ");
  111.     strcat ( buffer, (char *) language);
  112.     return buffer;
  113. }
  114.